﻿// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace SnapObjects.Data
{
    internal interface IAdoDbSchemaProvider
    {
        IReadOnlyList<DbColumnInfo> GetSqlColumnSchema(string sqlText, IEnumerable<IAdoDbParameter> parameters);

        Task<IReadOnlyList<DbColumnInfo>> GetSqlColumnSchemaAsync(
            string sqlText,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken);

        IReadOnlyList<ProcedureSchema> GetProcedureParameterSchema(string procedure);

        Task<IReadOnlyList<ProcedureSchema>> GetProcedureParameterSchemaAsync(
            string procedure, CancellationToken cancellationToken);

        IReadOnlyList<IReadOnlyList<DbColumnInfo>> GetProcedureColumnSchema(
            string procedure, IEnumerable<IAdoDbParameter> parameters);

        Task<IReadOnlyList<IReadOnlyList<DbColumnInfo>>> GetProcedureColumnSchemaAsync(
            string procedure,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken);

        IReadOnlyList<ProcedureSchema> GetFunctionParameterSchema(string function);

        Task<IReadOnlyList<ProcedureSchema>> GetFunctionParameterSchemaAsync(
            string function,
            CancellationToken cancellationToken);

        IReadOnlyList<IReadOnlyList<DbColumnInfo>> GetFunctionColumnSchema(
            string function,
            FunctionReturnType functionReturnType,
            IEnumerable<IAdoDbParameter> parameters);

        Task<IReadOnlyList<IReadOnlyList<DbColumnInfo>>> GetFunctionColumnSchemaAsync(
            string function,
            FunctionReturnType functionReturnType,
            IEnumerable<IAdoDbParameter> parameters,
            CancellationToken cancellationToken);

        IReadOnlyList<IAdoDbParameter> GetSqlParameterSchema(string sqlText);

        Task<IReadOnlyList<IAdoDbParameter>> GetSqlParameterSchemaAsync(string sqlText, CancellationToken cancellationToken);
    }
}
